SEO 核心指南
•
# SEO 核心指南
## 基本要求
### Url
- Url 中的非英文单词应该使用 UTF-8 编码,例如 https://example.com/**%E6%9D%82%E8%B4%A7/%E8%96%84%E8%8D%B7**
- 使用中划线 - 而不是下划线 _ 分割单词,搜索引擎会把 _ 当做连字符
- 对英文场景推荐在 url 中包含 slug 有利于 SEO。推荐使用 :id/:slug 的形式,即使 slug 缺失也能获取到到准确的内容。例如 https://foo.com/posts/1234/what-is-a-url-slug
https://developers.google.com/search/docs/crawling-indexing/url-structure
https://www.semrush.com/blog/what-is-a-url-slug
[连字符”-“和下划线”_”,URL中究竟应该使用哪一个?](https://adtodo.com/seo-hyphens-underscores/)
### Title
使用 - 或 |做标题分割
```html
<title>吐司 Tusi.Art - 可在线生图的模型分享社区,还是免费的!<title>
<title>不知火舞 | 游戏人物 | 游戏网</title>
```
大部分网站都使用 - 或 | 分割网站标题,英文网站 | 用的最多,Twitter 使用 /
百度推荐使用 - https://ziyuan.baidu.com/college/courseinfo?id=2988&page=3
### Description
在 160 字以内(Bing webmaster tools 是这么要求的)
https://rockcontent.com/blog/what-is-meta-description/
### Cotnent Rating
内容分级
```html
<meta name ="rating" content="adult">
```
### ⛔ Keywords
Keywords 由于被网站 SEO 滥用大部分搜索引擎已经不支持这个,比如 google、bing,貌似百度也不支持了
https://developers.google.com/search/docs/crawling-indexing/special-tags
### Social Metadata
https://www.digitalocean.com/community/tutorials/how-to-add-twitter-card-and-open-graph-social-metadata-to-your-webpage-with-html
#### og:
```html
<meta property="og:type" content="article">
<meta property="og:title" content="title">
<meta property="og:image" content="image url">
<meta property="og:description" content="xxxxx">
<meta property="og:author" content="author">
```
#### 微信
#### Twitter
https://developer.x.com/en/docs/twitter-for-websites/cards/guides/getting-started
```html
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@sitename" />
<meta name="twitter:creator" content="@authorname" />
<meta property="og:url" content="http://mysite.com/xxxx" />
<meta property="og:title" content="title" />
<meta property="og:description" content="maxlength 200" />
<meta property="og:image" content="image url" />
```
#### Facebook
https://developers.facebook.com/docs/sharing/webmasters/
支持标准的 og 标签
### 规范化网址 `<link rel="canonical" href="">`
避免不同 query 内容重复导致的 SEO 降权,百度、Google、Bing 都比较看重这个。
https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls
### Structured data
#### JSON-LD
https://www.link-assistant.com/news/structured-data-for-seo.html
Use Semantic Markup to convey information about the pages in either Schema.org, RDFa, or OpenGraph. Schema.org is preferred, in either JSON-LD or Microdata format. Note that Semantic Markup may enable Bing's rich features to be triggered. However it does not guarantee it. Verify Schema markup on your pages using [URL Inspection](https://www.bing.com/webmasters/help/URL-Inspection-55a30305).
需要注意,google 仅支持部分富媒体搜索结果
https://support.google.com/webmasters/answer/9012289#enhancements&zippy=%2C%E5%A2%9E%E5%BC%BA%E5%8A%9F%E8%83%BDamp%E5%AF%8C%E5%AA%92%E4%BD%93%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C
### `<h1><h1/>`
每个页面有且仅有一个 `h1` 标签。H1 标签最好能和 title 中的词有关联。
### <img alt="" />
所有 <img /> 都应该有 alt 属性,搜索引擎会根据 alt 来评估图片的内容。
### <a rel="" />
说明出站链接的意图,
- sponsored
- ugc
- nofollow
- noreferrrer
### robot.txt
需要有正确的 robot.txt 文件告知搜索引擎的爬虫哪些爬虫、页面允许访问。
### Sitemap
Sitemap 没有必要覆盖全站,主要针对搜索引擎在一开始可能不清楚网站有哪些内容,难以覆盖整站的资源。
参考
- https://www.bilibili.com/sitemap.xml
- https://www.youtube.com/sitemaps/sitemap.xml
将站内主要的栏目、路由写入 sitemap,再提供部分最新、热门资源的 sitemap 即可。
## 特定的场景
### Infinite Scroll
Google 会等待 js 执行并尝试滚动页面。但百度不会。
- 隐藏一个 a 标签,标明下一页
- ⛔ <link rel="next" href=""/>,Google 现已不支持这种写法,会自动滚动页面加载内容
https://developers.google.com/search/blog/2014/02/infinite-scroll-search-friendly
## 搜索引擎
### 国内
> 国内的搜索引擎好像都有一定的观察期,过了观察期收录才开始慢慢有量,据说这个过程要持续 1-3 个月。
- 百度 - 搜索资源平台 https://ziyuan.baidu.com/
- 360 - 360站长平台 https://zhanzhang.so.com/
- 搜狗 - 搜索资源平台 https://zhanzhang.sogou.com/
- 神马(夸克、UC)- 神马站长平台 https://zhanzhang.sm.cn/
### 全球
- Google - Google Search Console https://search.google.com/search-console/
- Bing - Webmaster Tools https://www.bing.com/webmasters/homepage
- DuckDuckGo - 不支持主动提交
- [Yandex](https://yandex.com/) - 俄罗斯 top1 https://webmaster.yandex.com/sites/
- [Naver](https://www.naver.com/) - 韩国 top1 https://searchadvisor.naver.com/
- ecosia.org - 欧洲 德国 top2 (好像会主动收录)
- Yahoo - Bing 提供搜索支持
### 性能对排名很重要
- https://csswizardry.com/2023/07/core-web-vitals-for-search-engine-optimisation/
## SEG 搜索生成式体验对 SEO 的影响
## SEO 分析工具
- ahrefs https://ahrefs.com/
- semrush https://www.semrush.com/
- similarweb https://similarweb.com
## 其他工具
https://metatags.io/
https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image
https://treo.sh/
https://www.serpchecking.com/
## 参考
Google 搜索文档 https://developers.google.com/search/docs
Ahrefs SEO Guide https://ahrefs.com/seo
图文展示了一个网站如何一步一步针对 Google 搜索进行优化 https://www.theverge.com/c/23998379/google-search-seo-algorithm-webpage-optimization
## 相关阅读
https://vercel.com/blog/how-google-handles-javascript-throughout-the-indexing-process